package collectionDemo;

import java.util.ArrayList;
import java.util.List;

/**
 * 验证api
 * @author zyj  2018-5-9 16:38:35
 *
 */
public class ArrayListDemo0 {
	static List aList;

	public static void main(String[] args) {

		List<String> listEmpty = new ArrayList<>();

		listEmpty.add("1");
		listEmpty.add("2");
		System.out.println(" size before== " + listEmpty.size());

		print(listEmpty);

		listEmpty.clear();
		System.out.println(" size clear== " + listEmpty.size());
		
		System.out.println((aList == null) + " -null- " + (listEmpty == null));
		System.out.println(" -isEmpty- " + (listEmpty.isEmpty()));
		try {
			System.out.println((aList.isEmpty()) + " -isEmpty- " + (listEmpty.isEmpty()));
		} catch (Exception e) {
			e.printStackTrace();
		}

	}

	private static void print(List<String> listEmpty) {

		new Thread(new Runnable() {

			@Override
			public void run() {

				try {
					Thread.sleep(1000);
					System.out.println("size thread==="+listEmpty.size());
				} catch (InterruptedException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}

			}
		}).start();

	}
}
